import { FC } from "react";
import questionInput_config,{questionInput_propsType} from "./questionInput/type";
import questionTitle_config,{questionTitle_propsType} from "./questionTitle/type";
import questionParagraph_config,{questionParagraph_propsType} from "./questionParagraph/type";
import questionInfo_config,{questionInfo_propsType} from "./questionInfo/type";
import questionTextarea_config,{questionTextarea_propsType} from "./questionTextarea/type";
import questionRadio_config,{questionRadio_propsType} from "./questionRadio/type";
import questionCheck_config,{questionCheck_propsType} from "./questionCheck/type";
//通用组件类型
export type componentPropsType =  questionInput_propsType & questionTitle_propsType & questionParagraph_propsType & questionInfo_propsType & questionTextarea_propsType & questionRadio_propsType & questionCheck_propsType 


export type componentConfigType = {
    type:string,
    Component:FC<componentPropsType>,
    PropsComponent:FC<componentPropsType>
    defaultvalue:componentPropsType
    StatComponent?:FC<any>
}

const componentConfigList:componentConfigType[] = [
    questionInput_config,
    questionTitle_config,
    questionParagraph_config,
    questionInfo_config,
    questionTextarea_config,
    questionRadio_config,
    questionCheck_config
]


export function getComponentByType(type:string){
    return componentConfigList.find((c)=>{
        return c.type === type
    })
}


export const componentGroup = [
    {
        id:'111',
        groupname:'用户显示',
        componengList:[questionTitle_config,questionParagraph_config,questionInfo_config]
    },
    {
        id:'222',
        groupname:'用户输入',
        componengList:[questionInput_config,questionTextarea_config]
    },
    {
        id:'333',
        groupname:'用户选择',
        componengList:[questionRadio_config,questionCheck_config]
    }
]






